const path = require('path')

const resolve = dir => {
	return path.join(__dirname, dir)
}

module.exports = {
	publicPath: './',
	outputDir: 'dist',
	assetsDir: 'static',
	lintOnSave: false, // 取消ESLint检验
	productionSourceMap: false,
	chainWebpack: config => {
		config.resolve.alias
			.set('@', resolve('src')) // key,value自行定义，比如.set('@@', resolve('src/components'))
			.set('@c', resolve('src/components'))
			.set('@api', resolve('src/api'))
			.set('@images', resolve('src/assets/images'))
			.set('@css', resolve('src/assets/css'))
			.set('@js', resolve('src/assets/js'))
	},
	devServer: {
		open: true,
		proxy: {	
			'/api': {
				// 目标 API 地址
				// target: 'http://192.168.50.62:8864/', // 接口的域名 雅玲
				target: 'http://192.168.253.1:81/', // 接口的域名 寻甸本地服务器
				// target: 'http://37fyac.natappfree.cc/', // 接口的域名
				// 如果要代理 websockets
				ws: false,
				// 将主机标头的原点更改为目标URL
				changeOrigin: true,
				pathRewrite: {
					'^': ''
				}
				// pathRewrite: {   //重写路径 比如'/api/aaa/ccc'重写为'/aaa/ccc'
				// '^/api/zzjserver': '/zzjserver'
				// }
 			},
		}
	}
} 
